from django.db import models

# Create your models here.
# 轮播图
class Carousel(models.Model):
    img = models.CharField("图片地址",max_length=300)
    def __str__(self):
        return '轮播图%d'%self.id

    class Meta:
        db_table = "carousel_tb"
        verbose_name = "轮播图"
        verbose_name_plural = verbose_name


# 类别
class Category(models.Model):
    name = models.CharField("类别名字",max_length=20)
    imgUrl = models.CharField("类别地址",max_length=200,null=False)
    class Meta:
        db_table = "category_tb"
        verbose_name = "类别"
        verbose_name_plural = verbose_name
    def __str__(self):
        return self.name


# 新商品
class Goods(models.Model):
    sku_name = models.CharField("商品名字",max_length=100)
    good_intro = models.CharField("商品介绍",max_length=100)
    cover_img = models.CharField("商品图片",max_length=200)
    selling_price = models.DecimalField("商品销售价格",max_digits=13,decimal_places=2)
    tag = models.CharField("商品标题",max_length=50)
    class Meta:
        db_table = "goods_tb"
        verbose_name = "商品信息"
    def __str__(self):
        return self.sku_name

# 热销商品
class HotGoods(models.Model):
    sku_name = models.CharField("商品名字", max_length=100)
    goodIntro = models.CharField("商品介绍", max_length=100)
    coverImg = models.CharField("商品图片", max_length=200)
    sellingPrice = models.DecimalField("商品销售价格", max_digits=13, decimal_places=2)
    tag = models.CharField("商品标题", max_length=50)

    class Meta:
        db_table = "hotgoods"
        verbose_name = "商品信息"

    def __str__(self):
        return self.sku_name
